#ifndef SETSERIALDIALOG_H
#define SETSERIALDIALOG_H

#include <QDialog>
#include <QComboBox>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QGroupBox>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLineEdit>
#include <QLabel>
#include <QDialogButtonBox>
#include <QMessageBox>
#include <QPushButton>

#include <GlobalVar.h>
using namespace GlobalVar;

class SetSerialDialog : public QDialog
{
    Q_OBJECT
public:
    SetSerialDialog();
    ~SetSerialDialog();

private slots:
    void sl_u_buttonBox_clicked(QAbstractButton *button);
    void sl_u_connectionGroupBox_currentIndexChanged(int index);

private:
    void _UiInit();
    QVBoxLayout *u_layout;
    QDialogButtonBox *u_buttonBox;

    void _ConnectionUiInit();
    void _FillConnectionUi();
    QGroupBox *u_connectionGroupBox;
    QComboBox *u_connectionComboBox;

    void _SerialUiInit();
    void _FillSerialUi();
    QGroupBox *u_serialGroupBox;
    QComboBox *u_serialPortCombox;
    QComboBox *u_baudRateCombox;
    QComboBox *u_dataBitsCombox;
    QComboBox *u_parityCombox;
    QComboBox *u_stopBitsCombox;

    void _TCPIPUiInit();
    void _FillTCPIPUi();
    QGroupBox *u_tcpipGroupBox;
    QLineEdit *u_ipAddressLineEdit;
    QLineEdit *u_portLineEidt;

    void _OtherUiInit();
    void _FillOther();
    QGroupBox *u_otherGroupBox;
    QLineEdit *u_responseTimeLineEdit;
    QLineEdit *u_numberOfRetriesLineEidt;

    void _LoadSettingFromFile();
};

#endif // SETSERIALDIALOG_H
